#ifndef _TMDEFIO_H_
#define _TMDEFIO_H_

# define TM_AXIS_X_STEP 9
# define TM_AXIS_Y_STEP 10
# define TM_AXIS_Z_STEP 11
# define TM_AXIS_X_DIR  4
# define TM_AXIS_Y_DIR  5
# define TM_AXIS_Z_DIR  6
# define TM_MOTOR_EN    7

#include "driver/mcpwm.h"

void TmPwmInit(uint32_t freq);
void TmPwmStartAll();
void TmPwmStopAll();

void tmPwmChangePerior(int axisIndex, uint32_t perior);
void TmPwmChangeFreqX(uint32_t perior);
void TmPwmChangeFreqY(uint32_t perior);
void TmPwmChangeFreqZ(uint32_t perior);

#define STEP_START_P mcpwm_start(MCPWM_UNIT_1, MCPWM_TIMER_0)
#define STEP_START_V mcpwm_start(MCPWM_UNIT_1, MCPWM_TIMER_1)
#define STEP_START_R mcpwm_start(MCPWM_UNIT_1, MCPWM_TIMER_2)

#define STEP_STOP_P mcpwm_stop(MCPWM_UNIT_1, MCPWM_TIMER_0)
#define STEP_STOP_V mcpwm_stop(MCPWM_UNIT_1, MCPWM_TIMER_1)
#define STEP_STOP_R mcpwm_stop(MCPWM_UNIT_1, MCPWM_TIMER_2)

#endif